﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObject;
using System.Data;
using Entity;

namespace GreenLife.Admin
{
    public partial class DanhSachHoaDon : System.Web.UI.Page
    {
        OrderBO oBO = new OrderBO();
        DataSet ds;
        protected void Page_Load(object sender, EventArgs e)
        {
            this.selectOrder();
        }

        public void selectOrder()
        {
            ds = oBO.getOrder();
            this.listOrder.DataSource = ds.Tables[0];
            this.listOrder.DataBind();
            CollectionPager1.PageSize = 5;//thay doi so ban tin hien thi
            CollectionPager1.DataSource = ds.Tables[0].DefaultView;
            CollectionPager1.BindToControl = listOrder;
            listOrder.DataSource = CollectionPager1.DataSourcePaged;
        }
        protected void cpRepeaterOrder_ItemDataBound(object sender, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "delete")
            {
                int sno = Int32.Parse(e.CommandArgument.ToString());
                Orders o = new Orders();
                o.OrdersID = sno;
                oBO.removeOrder(o);
                selectOrder();
            }
        }
    }
}